<template>
	<view class="page">
		<fu-custom bgColor="bg-white" :isBack="true" :isBottom="true">
		  <block slot="content">{{i18n['选择物流公司']}}</block>
		</fu-custom>
    <fu-loading v-if="isLoad"></fu-loading>
    <view class="logistics-wrap" v-else>
      <view class="logistics-item solid-bottom flex justify-between align-center" v-for="(item,index) in picker" :key="index" @click="chooseItem(item)">
        <view class="text-111 text-lg text-weight-400">
          {{item.name}}
        </view>
        <image :src="imgBaseUrl + 'global/checked.png'" mode="widthFix" class="image" v-show="item.checked"></image>
      </view>
    </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
        picker:[],
        isLoad:false
			}
		},
    onLoad() {
      this.getExpressList();
    },
		methods: {
      chooseItem(item){
        console.log(item)
        this.picker.forEach(val=>{
          val.checked = false;
        })
        item.checked = true;
        this.$forceUpdate();
        uni.$emit('company',item);
        setTimeout(()=>{
          uni.navigateBack({
            delta:1
          })
        },200)
      },
      // 获取物流公司列表
      getExpressList(){
        let that = this;
        this.isLoad = true;
      	that.$api.post(global.apiUrls.getGoodsAfterSaleGetLog)
      	.then(res => {
      		if(res.data.code == 1){
      			that.picker = res.data.data.list;
            // that.picker[0].checked = true;
      		}
          this.isLoad = false;
      	})
      	.catch(err => {
      		console.log(err)
          this.isLoad = false;
      	})

      },
		}
	}
</script>

<style lang="scss" scoped>
page{
  background: #FFFFFF;
}
.page{
  background: #FFFFFF;
  min-height: 100vh;
}
.logistics-wrap{
  padding: 0 24rpx;
  .logistics-item{
    height: 108rpx;
    line-height: 108rpx;
    .image{
      width: 32rpx;
      height: 32rpx;
    }
  }
}
</style>
